home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kio / renamedlg.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  5.6 KB  |  154 lines

  1. /* This file is part of the KDE libraries
  2.     Copyright (C) 2000 Stephan Kulow <coolo@kde.org>
  3.                        David Faure <faure@kde.org>
  4.                   2001 Holger Freyther <freyther@kde.org>
  5.  
  6.     This library is free software; you can redistribute it and/or
  7.     modify it under the terms of the GNU Library General Public
  8.     License as published by the Free Software Foundation; either
  9.     version 2 of the License, or (at your option) any later version.
  10.  
  11.     This library is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.     Library General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU Library General Public License
  17.     along with this library; see the file COPYING.LIB.  If not, write to
  18.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19.     Boston, MA 02110-1301, USA.
  20. */
  21.  
  22. #ifndef __kio_rename_dlg__
  23. #define __kio_rename_dlg__
  24.  
  25. #include <kurl.h>
  26. #include <qdialog.h>
  27. #include <qstring.h>
  28. #include <sys/types.h>
  29.  
  30. #include <kio/global.h>
  31.  
  32. namespace KIO {
  33.  
  34. // KDE4: get rid of M_OVERWRITE_ITSELF, trigger it internally if src==dest
  35. enum RenameDlg_Mode { M_OVERWRITE = 1, M_OVERWRITE_ITSELF = 2, M_SKIP = 4, M_SINGLE = 8, M_MULTI = 16, M_RESUME = 32, M_NORENAME = 64 };
  36.  
  37. /**
  38.  * The result of open_RenameDlg().
  39.  */
  40. enum RenameDlg_Result { R_RESUME = 6, R_RESUME_ALL = 7, R_OVERWRITE = 4, R_OVERWRITE_ALL = 5, R_SKIP = 2, R_AUTO_SKIP = 3, R_RENAME = 1, R_CANCEL = 0 };
  41.  
  42.  
  43. /**
  44.  * A dialog for the options to rename two files.
  45.  * @short A dialog for renaming files.
  46.  * @since 3.1
  47.  */
  48. class KIO_EXPORT RenameDlg : public QDialog
  49. {
  50.   Q_OBJECT
  51. public:
  52.   /**
  53.    * Construct a "rename" dialog.
  54.    * @param parent parent widget (often 0)
  55.    * @param caption the caption for the dialog box
  56.    * @param src the url to the file/dir we're trying to copy, as it's part of the text message
  57.    * @param dest the path to destination file/dir, i.e. the one that already exists
  58.    * @param mode parameters for the dialog (which buttons to show...),
  59.    * @param sizeSrc size of source file
  60.    * @param sizeDest size of destination file
  61.    * @param ctimeSrc creation time of source file
  62.    * @param ctimeDest creation time of destination file
  63.    * @param mtimeSrc modification time of source file
  64.    * @param mtimeDest modification time of destination file
  65.    * @param modal set to true for a modal dialog
  66.    * @see RenameDlg_Mode
  67.    */
  68.   RenameDlg( QWidget *parent, const QString & caption,
  69.              // KDE4: make those KURLs, and use pathOrURL() internally.
  70.              const QString & src, const QString & dest,
  71.              RenameDlg_Mode mode,
  72.              KIO::filesize_t sizeSrc = (KIO::filesize_t) -1,
  73.              KIO::filesize_t sizeDest = (KIO::filesize_t) -1,
  74.              time_t ctimeSrc = (time_t) -1,
  75.              time_t ctimeDest = (time_t) -1,
  76.              time_t mtimeSrc = (time_t) -1,
  77.              time_t mtimeDest = (time_t) -1,
  78.              bool modal = false );
  79.   ~RenameDlg();
  80.  
  81.   /**
  82.    * @return the new destination
  83.    * valid only if RENAME was chosen
  84.    */
  85.   KURL newDestURL();
  86.  
  87.   /**
  88.    * Given a directory path and a filename (which usually exists already),
  89.    * this function returns a suggested name for a file that doesn't exist
  90.    * in that directory. The existence is only checked for local urls though.
  91.    * The suggested file name is of the form foo_1 foo_2 etc.
  92.    * @since 3.4
  93.    */
  94.   static QString suggestName(const KURL& baseURL, const QString& oldName);
  95.  
  96. public slots:
  97.   /// KDE4: rename to cancelPressed(), renamePressed() etc.
  98.   void b0Pressed();
  99.   void b1Pressed();
  100.   void b2Pressed();
  101.   void b3Pressed();
  102.   void b4Pressed();
  103.   void b5Pressed();
  104.   void b6Pressed();
  105.   void b7Pressed();
  106.   void b8Pressed();
  107.  
  108. protected slots:
  109.   void enableRenameButton(const QString &);
  110. private:
  111.  class RenameDlgPrivate;
  112.  RenameDlgPrivate *d;
  113.  void pluginHandling( );
  114. };
  115.  
  116.   /**
  117.    * \addtogroup renamedlg "RenameDlg related Functions"
  118.    *  @{
  119.    * \relates KIO::RenameDlg
  120.    * Construct a modal, parent-less "rename" dialog, and return
  121.    * a result code, as well as the new dest. Much easier to use than the
  122.    * class RenameDlg directly.
  123.  
  124.    * @param caption the caption for the dialog box
  125.    * @param src the URL of the file/dir we're trying to copy, as it's part of the text message
  126.    * @param dest the URL of the destination file/dir, i.e. the one that already exists
  127.    * @param mode parameters for the dialog (which buttons to show...),
  128.    *             see RenameDlg_Mode
  129.    * @param newDest the new destination path, valid if R_RENAME was returned.
  130.    * @param sizeSrc size of source file
  131.    * @param sizeDest size of destination file
  132.    * @param ctimeSrc creation time of source file
  133.    * @param ctimeDest creation time of destination file
  134.    * @param mtimeSrc modification time of source file
  135.    * @param mtimeDest modification time of destination file
  136.    * @return the result
  137.    */
  138. KIO_EXPORT RenameDlg_Result open_RenameDlg( const QString & caption,
  139.                                  // KDE4: make those KURLs
  140.                                  const QString& src, const QString & dest,
  141.                                  RenameDlg_Mode mode, QString& newDestPath,
  142.                                  KIO::filesize_t sizeSrc = (KIO::filesize_t) -1,
  143.                                  KIO::filesize_t sizeDest = (KIO::filesize_t) -1,
  144.                                  time_t ctimeSrc = (time_t) -1,
  145.                                  time_t ctimeDest = (time_t) -1,
  146.                                  time_t mtimeSrc = (time_t) -1,
  147.                                  time_t mtimeDest = (time_t) -1
  148.                                  );
  149.  
  150. /*! @} */
  151.  
  152. }
  153. #endif
  154.